package com.lx.video.web;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
import com.lx.bilibili.entity.UserAndVideo;
import com.lx.bilibili.entity.Video;
import com.lx.bilibili.entity.VideoEx;
import com.lx.video.dao.UserAndVideoMapper;
import com.lx.video.dao.VideoExMapper;
import com.lx.video.dao.VideoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("video")
public class VideoController {

    @Autowired
    VideoExMapper videoExMapper;

    @Autowired
    VideoMapper videoMapper;

    @Autowired
    UserAndVideoMapper userAndVideoMapper;

    @RequestMapping("recVideo")
    public List<VideoEx> recVideo(int page, int count){

        return videoExMapper.recVideo((page-1) * count, count);
    }


    @RequestMapping("getHotVideoByIdLimit")
    public List<Video> getHotVideoByIdLimit(int id){
        return videoMapper.getHotVideoByIdLimit(id);
    }

    @RequestMapping("getVideoByVid")
    public UserAndVideo getVideoByVid(int id){
        return userAndVideoMapper.getUserAndVideoById(id);
    }


}
